import { createApp } from 'vue'
import App from './App.vue'
import {buildRoutes,router} from './router/index'
// @ts-ignore
import ProLayout from '@ant-design-vue/pro-layout'
import { store } from '@/store/index';
import '@ant-design-vue/pro-layout/dist/style.css'
import './style.css'
// const app = createApp(App)
// app.use(router).use(store).use(ProLayout).mount('#app')



async function getLoginInfo() {
    try {
      let menuRouterList:any = []
      buildRoutes(menuRouterList);
      initVue();
    //   const userinfo = await loginApi.getLoginInfo();
    //   useUserStore().setUserLoginInfo(userinfo.data);
    } catch (e) {
      console.log('main',e)
    //   clearAllCoolies();
    //   router.push('/login');
    }
}
function initVue() {
    let vueApp = createApp(App);
    let app = vueApp.use(router).use(store).use(ProLayout);
    app.mount('#app');
}
// let token = getTokenFromCookie();
let token = ''
if (!token) {
  initVue();
} else {
  getLoginInfo();
}